<template>
	<view>
		<view class="bartop"></view>
		<view class="cu-bar">
			<view class="action">
				<text class="cuIcon-back text-gray" @tap="goBack"></text> 返回
			</view>
			<view class="text-lg text-bold">
				今日数据统计列表
			</view>
			<view class="action">
				<text class="text-lg" style="color: #13227a;" @tap="reload">刷新</text>
			</view>
		</view>
		<view class="cu-list menu">
			<view v-for="(item,index) in statisticsList" :key="index" @click="showDetail(item)" class="cu-item"
				:style="index%2==0?'background:#fff':'background:#dedede' ">
				<text>注塑车间生产日报表（{{item.todayDate}}{{item.classesName}}{{item.operatorCount}}人）-{{item.directorName}}</text>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				statisticsList: []
			}
		},
		onLoad(options) {
			this.getStatisticsList()
		},

		methods: {
			goBack() {
				uni.navigateBack({
					delta: 1
				})
			},
			reload() {
				uni.showLoading({
					title: '刷新中...',
					mask: false
				});
				this.$Request.get(this.$httpApi.form.getStatisticsList).then(res => {
					uni.hideLoading()
					if (res.code == 200) {
						uni.showToast({
							title: "刷新成功"
						});
						this.statisticsList = res.data

					} else {
						uni.showToast({
							title: res.message
						});
					}
				})
			},
			getStatisticsList() {
				this.$Request.get(this.$httpApi.form.getStatisticsList).then(res => {
					if (res.code == 200) {
						this.statisticsList = res.data
					}
				})
			},
			showDetail(item) {
				uni.navigateTo({
					url: "/pages/planner/form_manage_detail/form_manage_detail?data=" + JSON.stringify(
						item)
				})
			}

		}
	}
</script>

<style>

</style>
